package com.haofengsoft.scce.controller.mine;

import android.content.Context;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.haofengsoft.scce.adapter.mine.MinePersonalModel;

public class UserPersonalController {
	private static UserPersonalController instance = null;
	private Context context;

	public static synchronized UserPersonalController getInstance(
			Context context) {
		if (instance == null) {
			instance = new UserPersonalController(context);
		}
		return instance;
	}

	public UserPersonalController(Context context) {
		this.context = context;
	}

	public MinePersonalModel gainUserPersonalInfo(String json) {
		MinePersonalModel userPersonalModel = new MinePersonalModel();
		try {
			JSONObject userObj = JSON.parseObject(json);
			JSONObject userCustomObj = userObj.getJSONObject("Customer");
			userPersonalModel.setNickName(userCustomObj.getString("UserName"));
			userPersonalModel.setRealName(userCustomObj.getString("RealName"));
			userPersonalModel.setTel(userCustomObj.getString("UserAccount"));
			userPersonalModel.setEmail(userCustomObj.getString("Email"));
		} catch (Exception e) {

		}

		return userPersonalModel;
	}
}
